<!--
 * @description: 更新窗口对应的页面
 * @Author: lal
 * @Date: 2020-08-15 11:17:51
 * @LastEditors: lal
 * @LastEditTime: 2020-08-27 10:38:11
-->
<template>
  <div class="container">
    更新窗口对应的页面
    <p>更新信息：{{ appInfo.content }}</p>
    <p>
      <el-button @click="update">现在更新</el-button>
    </p>
    <el-progress type="circle" :percentage="percent"></el-progress>
  </div>
</template>

<script>
import { ipcRenderer } from "electron";
export default {
  name: "zcs-vue",
  props: {},
  data() {
    return {
      appInfo: {},
      percent: 0,
    };
  },
  computed: {},
  created() {},
  methods: {
    update() {
      ipcRenderer.send("downloadApp");
    },
  },
  mounted() {
    ipcRenderer.on("appUpdateInfo", (e, v) => {
      this.appInfo = v;
    });
    ipcRenderer.on("progress", (e, progress) => {
      let per = progress.progress.toFixed(2);

      this.percent = per;
    });
  },
};
</script>

<style scoped lang="scss"></style>
